package extended

import (
	"jvm/nzpJvm/instructions/base"
	"jvm/nzpJvm/runtime_area"
)

// 如果对象为null，则跳转
type IFNULL struct {
	base.BranchInstruction
}

// 如果对象不为null，则跳转
type IFNONNULL struct {
	base.BranchInstruction
}


func (self *IFNULL) Execute(frame *runtime_area.Frame) {
	ref := frame.OperandStack().PopRef()
	if ref == nil {
		base.Branch(frame, self.Offset)
	}
}
func (self *IFNONNULL) Execute(frame *runtime_area.Frame) {
	ref := frame.OperandStack().PopRef()
	if ref != nil {
		base.Branch(frame, self.Offset)
	}
}
